﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using Medianamik.Core.ImportExport;

namespace Medianamik.Core.ImportExport
{
    public class NodeTypeImporter
    {
        //#region Events

        //public event EventHandler<RecordTypesImportingEventArgs> RecordTypesImporting;
        //protected virtual bool OnRecordTypesImporting(IList<RecordType> typesToImport)
        //{
        //    EventHandler<RecordTypesImportingEventArgs> recordTypesImporting = RecordTypesImporting;
        //    bool canceled = false;

        //    if (recordTypesImporting != null)
        //    {
        //        RecordTypesImportingEventArgs e = new RecordTypesImportingEventArgs(typesToImport);
        //        recordTypesImporting(this, e);
        //        return e.Cancel;
        //    }

        //    return canceled;
        //}

        //public event EventHandler<RecordTypesImportEndedEventArgs> RecordTypesImportEnded;
        //protected virtual void OnRecordTypesImportEnded(IList<RecordType> typesToImport,
        //    int iterations, int importedTypesCount)
        //{
        //    EventHandler<RecordTypesImportEndedEventArgs> recordTypesImportEnded = RecordTypesImportEnded;

        //    if (recordTypesImportEnded != null)
        //    {
        //        RecordTypesImportEndedEventArgs e = new RecordTypesImportEndedEventArgs(typesToImport,
        //            iterations, importedTypesCount);
        //        recordTypesImportEnded(this, e);
        //    }
        //}

        //#endregion

        public void ImportData(IEnumerable<RecordType> recordTypes)
        {
            //TODO : Événements pour pouvoir (en autre) faire des logs

            //int iterations = 0;
            //int importedTypesCount = 0;
            //bool canceled = OnRecordTypesImporting(data.RecordTypes);

            //while (!canceled && iterations < data.RecordTypes.Count)
            //{

            //}

            //OnRecordTypesImportEnded(data.RecordTypes, iterations, importedTypesCount);
        }
    }
}

//#region EventArgs

//public class RecordTypesImportingEventArgs : CancelEventArgs
//{
//    public RecordTypesImportingEventArgs(IList<RecordType> typesToImport)
//    {
//        _typesToImport = typesToImport;
//    }

//    #region Properties

//    public IList<RecordType> TypesToImport
//    {
//        get { return _typesToImport; }
//    }
//    IList<RecordType> _typesToImport;

//    #endregion
//}

//public class RecordTypesImportEndedEventArgs : EventArgs
//{
//    public RecordTypesImportEndedEventArgs(IList<RecordType> typesToImport,
//        int iterations, int importedTypesCount)
//    {
//        _typesToImport = typesToImport;
//        _iterations = iterations;
//        _importedTypesCount = importedTypesCount;
//    }

//    #region Properties

//    public IList<RecordType> TypesToImport
//    {
//        get { return _typesToImport; }
//    }
//    IList<RecordType> _typesToImport;

//    public int Iterations
//    {
//        get { return _iterations; }
//    }
//    int _iterations;

//    public int ImportedTypesCount
//    {
//        get { return _importedTypesCount; }
//    }
//    int _importedTypesCount;

//    #endregion
//}

//#endregion
